﻿@model HANS_BackStage.Model.WebModel.MenuItem
    @using HANS.Utility.Extensions;
<li class="@(Model.IsActive ? "current-page" : "")"> @*@(Model.IsActive ? "active" : "")*@
    @{
        string url = (Model.Action.IsNullOrWhiteSpace() || Model.Controller.IsNullOrWhiteSpace())
            ? "javascrpt:void(0)"
            : Url.Action(Model.Action, Model.Controller, new { area = Model.Area });
        if (url.Equals("javascript:void(0)") && Model.Url.IsNotNullAndNotWhiteSpace())
        {
            url = Model.Url;
        }
    }
    <a href="@url">
        <i class="fa @Model.Css"></i>
        @Model.MenuItemName
        @if (Model.ChildrensMenuItem.Any())
        {
            <span class="fa fa-chevron-down"></span>
        }
    </a>
    @if (Model.ChildrensMenuItem.Any())
    {
        <ul class="nav child_menu" style="display: none;">
            @foreach (var subMenuItem in Model.ChildrensMenuItem)
            {
                @Html.Partial("_MenuItem", subMenuItem)
            }
        </ul>
    }
</li>